package org.example.controller.post;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.example.annotation.HasRole;
import org.example.dao.commom.Result;
import org.example.dao.commom.ResultCode;
import org.example.dao.entity.post.PTheme;
import org.example.service.post.ThemeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 22449
 */
@RestController
@RequestMapping("/post")
@CrossOrigin
public class ThemeController {

    //TODO 新增
    /**
     * 新增主题列表(管理)
     */
    @PostMapping("addTheme")
    public Result addTheme(@RequestBody PTheme pTheme){

        return null;
    }

    //TODO 查询

    /**
     * 获取主题列表(用户)
     */
    @HasRole(role = "用户")
    @PostMapping("getThemeList/{start}/{limit}")
    public Result getThemeList(@PathVariable("start") Integer start,
                               @PathVariable("limit") Integer limit) {
        IPage<PTheme> list = themeService.getThemeList(start,limit);
        return new Result(ResultCode.SUCCESS, list);
    }

    //TODO 更新
    /**
     * 更新主题(管理)
     */
    @PostMapping("updateTheme")
    public Result updateTheme(@RequestBody PTheme pTheme){

        return null;
    }


    //TODO 删除
    /**
     * 删除主题(管理)
     */
    @PostMapping("deleteTheme")
    public Result deleteTheme(@RequestBody PTheme pTheme){

        return null;
    }

    /**
     * 批量删除主题(管理)
     */
    @PostMapping("deleteThemes")
    public Result deleteThemes(@RequestBody List<Long> ids){

        return null;
    }
    @Resource
    private ThemeService themeService;


}
